package com.ac.controller;

import java.util.Map;

import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ac.response.Res;

import ch.qos.logback.classic.Logger;
import lombok.RequiredArgsConstructor;

@RestController
@RequestMapping("home")
@RequiredArgsConstructor
public class HomeController {

	private static final Logger logger = (Logger) LoggerFactory.getLogger(HomeController.class);

	@PostMapping(value = "post", produces = "application/json;charset=UTF-8")
	public String post(@RequestBody Map<String, String> req) {
		logger.info("接口数据处理完毕返回");
		return "POST:Hello Docker";
	}

	@GetMapping(value = "list")
	public Res list() {
		return Res.success("list");
	}

	@GetMapping(value = "add")
	public String add() {
		return "home:添加数据完毕";
	}

	@GetMapping(value = "addError")
	public String addError() {
		return "home:添加Error数据完毕";
	}

	@GetMapping(value = "remove")
	public String remove() {
		return "home:清空数据完毕";
	}

}
